<%--
  Created by IntelliJ IDEA.
  User: WYX
  Date: 2024/4/7
  Time: 8:01
  To change this template use File | Settings | File Templates.
--%>
<%@ page contentType="text/html;charset=UTF-8" %>
<html>
<head>
    <title>day01</title>
</head>
<body>
<jsp:useBean id="circle" class="wyx240407.Day01"/>
<%
    out.print("圆的半径为："+ circle.getR()+"<br>圆的周长为："+ circle.getCircumference()+"<br>圆的面积为："+ circle.getArea()+"<br>");
%>
<form action="" method="post">
    <label>
        输入半径
        <input type="text" name="r">
    </label>
    <input type="submit" value="提交"><br>
    <% try{
        if(request.getParameter("r")!=null){
            double r=Double.parseDouble(request.getParameter("r"));
            if(r>0){
                circle.setR(r);
                out.print("修改后圆的半径为："+ circle.getR()+"<br>修改后圆的周长为："+ circle.getCircumference()+"<br>修改后圆的面积为："+ circle.getArea()+"<br>");
            }else out.print("输入有误<br>");
        }
    }catch(Exception e) {
    out.print("输入有误!<br>");
    out.print(e+"<br>");
}%>
</form>
</body>
</html>